from PIL import Image

def keep_img_size(path,size=(256,256)):
    img=Image.open(path)
    temp=max(img.size)
    mask=Image.new('RGB',(temp,temp))
    mask.paste(img,(0,0))
    mask=mask.resize(size)
    return mask